//
//  TopImageCell.m
//  WXMovie
//
//  Created by apple on 16/4/2.
//  Copyright © 2016年 zic_magic. All rights reserved.
//

#import "TopImageCell.h"

@implementation TopImageCell


- (void)awakeFromNib {
    
    [super awakeFromNib];
    [self setModel:_model];
    
}

//- (instancetype)initWithFrame:(CGRect)frame
//{
//    self = [super initWithFrame:frame];
//    if (self) {
//        
//        [self setModel:_model];
//        
//    }
//    return self;
//}



- (void)setModel:(TopImagemodel *)model {
    
    _model = model;
    
    _titleLabel.text = model.title;
//    NSLog(@"%@", _titleLabel.text);
    
    _ratingLabel.text = [NSString stringWithFormat:@"%.1f", [model.rating[@"average"] floatValue]];
    [_imgView sd_setImageWithURL:[NSURL URLWithString:_model.image] placeholderImage:[UIImage imageNamed:@"pig"]];
    [_starview changeStarViewWidthWithRating:[self.ratingLabel.text floatValue]];
 
    _starview.transform = CGAffineTransformConcat(CGAffineTransformMakeScale(0.8, 0.9), CGAffineTransformMakeTranslation(-10, 0));
    
}


@end
